#pragma once

#include <nlohmann/json.hpp>
#include "rviz_custom_plugins/models/download_config.h"
#include "rviz_custom_plugins/models/map_config.h"
#include "rviz_custom_plugins/models/mission_config.h"
#include <QMetaType>


using nlohmann::json;


namespace rviz_custom_plugins 
{


namespace models 
{


class Project
{

public:
    std::string name;

    MissionConfig missionConfig;

    MapConfig mapConfig;

    DownloadConfig downloadConfig;

};


inline void to_json(json& j, const Project& project) 
{
    j = json{
        {"name", project.name},
        {"missionConfig", project.missionConfig},
        {"mapConfig", project.mapConfig},
        {"downloadConfig", project.downloadConfig}
    };
}


inline void from_json(const json& j, Project& project)
{
    project.name = j.value("name", "");
    project.missionConfig = j.at("missionConfig");
    project.mapConfig = j.at("mapConfig");
    project.downloadConfig = j.at("downloadConfig");
}



}


}


Q_DECLARE_METATYPE(rviz_custom_plugins::models::Project)